package com.treasure.mall.biz.dto.community;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.treasure.mall.biz.dto.BaseSaveDTO;
import com.treasure.mall.biz.entity.user.UserPO;
import com.treasure.mall.zbq.common.ienum.community.CommunityEnums;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 
 * <p>
 * +---------------------------------------------------------
 * * @package: com.treasure.mall.biz.dto.community
 * * @author: guomw (guomwchen@foxmail.com)
 * * @date: 2020/7/27 7:30 下午
 * * @since: V1.0.0
 * +---------------------------------------------------------
 * 注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的
 * 
 */
@Data
public class CommunityArticleSaveDTO implements BaseSaveDTO {
    /**
     * 文章ID
     */
    private long articleId;

    /**
     * 标题
     */
    private String title;
    /**
     * 文章详情
     */
    private String description;

    /**
     * 图片列表
     */
    private List<String> picList;

    /**
     * 视频文件地址
     */
    private String videoUrl;
    /**
     * 封面图片地址
     */
    private String coverUrl;

    /**
     * 作者
     */
    @JsonIgnore
    private UserPO user;

    public CommunityEnums.ContentType getContentType() {
        if (StringUtils.isNotBlank(this.videoUrl)) {
            return CommunityEnums.ContentType.VIDEO_TEXT;
        }
        return CommunityEnums.ContentType.IMAGE_TEXT;

    }

}
